<?php 
require_once (dirname(__FILE__).'/services.php');

function demo_index($matches) {
    echo 'xx';
}

function demo_admin_index($matches) {
    global $mvc;
    
    $method = $_SERVER['REQUEST_METHOD'];
    if ($method == "GET") {
    	global $content;
		$c = service_demo_get();echo $c;
    	$mvc->render(dirname(__FILE__)."/views/_admin_demo_index_.php");
    } elseif ($method == "POST") {
    	$content = $_POST['content'];
		service_demo_update($content);
		$mvc->redirect(REQUEST_BASE."admin/demo/");
    }
}

global $mvc;
$mvc = new MVC(Array('{^/demo/$}'=>'demo_index', '{^/admin/demo/$}'=>'demo_admin_index'));
$mvc -> dispatch($GLOBALS['uri']);

?>
